import request from '@/utils/request'
import { PageData, Resp, LoginParam, User, Menu, Role } from '@/types'

/**
 * 登陆请求，响应返回User数据
 * @param param
 */
export const postLogin = (param: LoginParam): Promise<Resp<User>> => {
  return request({
    url: './mock/login.json',
    method: 'post',
    data: param,
  })
}

/**
 * 菜单请求，响应返回Menu数据
 */
export const postMenu = (): Promise<Resp<Menu[]>> => {
  return request({
    url: './mock/menu.json',
    method: 'post',
  })
}

export const pageUserList = (): Promise<Resp<PageData<User>>> => {
  return request({
    url: './mock/userList.json',
    method: 'post',
  })
}

export const pageRoleList = (): Promise<Resp<PageData<Role>>> => {
  return request({
    url: './mock/roleList.json',
    method: 'post',
  })
}

export const listMenu = () => {
  return request({
    url: './mock/roleList.json',
    method: 'post',
  })
}
